package com.itheima;

import com.itheima.config.SpringConfig;
import com.itheima.service.AccountService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class) //spring整合junit
@ContextConfiguration(classes = SpringConfig.class)
public class MyApp {

    @Autowired
    private AccountService accountService;

    @Test
    public void test01(){

        System.out.println("获取到的为代理对象"+accountService.getClass());
        accountService.findAll();

    }

    @Test
    public void test02(){
        //没有使用aop
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            String result = accountService.findAll();
        }
        long end = System.currentTimeMillis();
        System.out.println(end - start);

    }
}
